 <script>
  function loadRoom()
  {
	//alert('aaaaaaaaaaaaaaaaaaaaaaaaa');
  var xmlhttp;
  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      document.getElementById("dsphong").innerHTML=xmlhttp.responseText;
    }
  }
  var tang=document.getElementById('select').value;
  //var daynha=document.getElementById('sldaynha').value;
//  alert(tang);
xmlhttp.open("GET","get_all_room_by_floor.php?tang="+tang,true);
xmlhttp.send();
}
</script>
<?php 
include('../template/header.php');
include('../template/menuleft.php');
include('../template/menuright.php');

include '../config/DBConnect.php';
$sql="SELECT * FROM tbl_tang";
$query=mysql_query($sql);
$tang=array();
if (mysql_num_rows($query) > 0){

  while($rows=mysql_fetch_array($query)){
    $temp=array();
    $temp['id']=$rows['id'];
    $temp['tang']=$rows['tang'];
    array_push($tang,$temp);
  }
}
?>
<script>
  function showId(id){
   var xmlhttp;
   if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      document.getElementById("dsphong").innerHTML=xmlhttp.responseText;
    }
  }
  var tang=document.getElementById('select').value;
  //var daynha=document.getElementById('sldaynha').value;
//  alert(tang);
xmlhttp.open("GET","thongtinphong.php?maphong="+id,true);
xmlhttp.send();
}
</script>

<div class="viewct" >
  <center><h3> Thông Tin Phòng</h3></center><br /><br />       
  <div class="luachon">
   <select name="tang" id="select" onChange="loadRoom()">
    <option value="">-----Chọn Tầng----</option>
    <?php 
    for($i=1; $i<=count($tang);$i++){
     ?>
     <option value="<?php echo $i;?>"> Tầng <?php echo $i;?></option>
     <?php }?>
   </select>
   <div id="dsphong">
    <!-- cho nay  nay la cai bang-->
  </div>

</div>      
</div>


<?php 
include('../template/footer.php');
?>
